package com.example.demo.pattern.iteratorpattern;

public class Waitness {
    private final CompositeIterator compositeIterator;

    public Waitness(MenuComponent menuComponentList) {
        compositeIterator = new CompositeIterator(menuComponentList.iterator());
    }

    public void print() {
        while (compositeIterator.hasNext()) {
            compositeIterator.next().print();
        }
    }
}
